﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace QLTV.Forms.KhaiBao
{
    public partial class frmPhongNghiepVu : BaseForm
    {
        public frmPhongNghiepVu()
        {
            InitializeComponent();
            statusDataBar1.addTextChange(gridView1);
            statusDataBar1.addTextChange(tblPhongBindingSource);

        }

        private void frmPhongNghiepVu_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'dsUsers.tblPhong' table. You can move, or remove it, as needed.
            this.tblPhongTableAdapter.Fill(this.dsUsers.tblPhong);

        }

        private void statusDataBar1_UpdateClick(object sender, StatusDataBar.StatusDataBarArgs e)
        {
            tblPhongBindingSource.EndEdit();
            tblPhongTableAdapter.Update(dsUsers.tblPhong);
            alertControl1.Show(this, rm.GetString("sMessageCaption", myCultureInfo), rm.GetString("sMessageSuccess", myCultureInfo));
        }

        private void statusDataBar1_UndoClick(object sender, StatusDataBar.StatusDataBarArgs e)
        {
            tblPhongBindingSource.CancelEdit();
        }

        private void statusDataBar1_DeleteClick(object sender, StatusDataBar.StatusDataBarArgs e)
        {
            if (gridView1.FocusedRowHandle > -1)
                if (XtraMessageBox.Show(rm.GetString("sConfirm", myCultureInfo), rm.GetString("sMessageCaption", myCultureInfo), MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
                {
                    tblPhongBindingSource.RemoveCurrent();
                    tblPhongBindingSource.EndEdit();
                    tblPhongTableAdapter.Update(dsUsers.tblPhong);
                    alertControl1.Show(this, rm.GetString("sMessageCaption", myCultureInfo), rm.GetString("sMessageSuccess", myCultureInfo));
                }
        }
    }
}